package pluginGraphe;

import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.BevelBorder;

public class GraphePlageCellule extends JComponent implements Observer{
	private static final long serialVersionUID = 3079676956820109707L;

	private IVueGraphe vue;
	private PlageCellule modele;
	
	public GraphePlageCellule(IVueGraphe vue, PlageCellule l) {
		super();
		this.vue = vue;
                this.modele = l;
		setSize(getPreferredSize());
		this.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));		
	}

    @Override
	public Dimension getPreferredSize() {
		return getMinimumSize();
	}
        
    @Override
	public Dimension getMinimumSize() {
		return new Dimension(400, 250);
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		vue.dessine(this, (Graphics2D)g, modele);
	}

    @Override
    public void update(Observable o, Object o1) {
        repaint();
    }
        
}
